package datasource.config;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by Administrator on 2017/9/14.
 */
public class c3p0Config {
    public static ComboPooledDataSource cpds = null;
    //只需要创建一次？ static代码块 只需一次
    static {
        //C3P0的数据源对象
        cpds = new ComboPooledDataSource("c3p0");
    }
    public static Connection getConnection() throws SQLException {
        return cpds.getConnection();
    }
}
